import { createRouter, createWebHashHistory } from 'vue-router'
import Layout from '@/layout'

export const constantRoutes = [
  {
    path: '/login',
    component: () => import('@/views/login'),
    hidden: true,
  },
  {
    path: '/403',
    name: '403',
    component: () => import('@/views/403'),
    hidden: true,
  },
  {
    path: '/404',
    name: '404',
    component: () => import('@/views/404'),
    hidden: true,
  },
  // {
  //   path: '/formDevelopment',
  //   name: 'formDevelopment',
  //   component: () =>
  //     import(
  //       '@/views/info/commonSupport/formManagement/formConfiguration/components/formDevelopment.vue'
  //     ),
  //   meta: {
  //     title: '采集表单配置',
  //     icon: 'table-2',
  //   },
  // },
]
export const asyncRoutes = [
  {
    path: '/',
    component: Layout,
    redirect: '/index',
    meta: {
      title: '首页',
      icon: 'home-4-line',
      affix: true,
    },
    children: [
      {
        path: 'index',
        name: 'Index',
        component: () => import('@/views/index'),
        meta: {
          title: '首页',
          icon: 'home-4-line',
          affix: true,
        },
      },
    ],
  },
  {
    path: '/vab',
    component: Layout,
    redirect: '/vab/table',
    alwaysShow: true,
    meta: {
      title: '组件',
      icon: 'apps-line',
    },
    children: [
      {
        path: 'table',
        name: 'Table',
        component: () => import('@/views/vab/table'),
        meta: {
          title: '表格',
          icon: 'table-2',
        },
      },
      {
        path: 'icon',
        name: 'Icon',
        component: () => import('@/views/vab/icon'),
        meta: {
          title: '图标',
          icon: 'remixicon-line',
        },
      },
    ],
  },
  {
    path: '/test',
    component: Layout,
    redirect: '/test/test',
    meta: {
      title: '动态路由测试',
      icon: 'test-tube-line',
    },
    children: [
      {
        path: 'test',
        name: 'Test',
        component: () => import('@/views/test'),
        meta: {
          title: '动态路由测试',
          icon: 'test-tube-line',
        },
      },
    ],
  },
  {
    path: '/error',
    name: 'Error',
    component: Layout,
    redirect: '/error/403',
    meta: {
      title: '错误页',
      icon: 'error-warning-line',
    },
    children: [
      {
        path: '403',
        name: 'Error403',
        component: () => import('@/views/403'),
        meta: {
          title: '403',
          icon: 'error-warning-line',
        },
      },
      {
        path: '404',
        name: 'Error404',
        component: () => import('@/views/404'),
        meta: {
          title: '404',
          icon: 'error-warning-line',
        },
      },
    ],
  },
  {
    path: '/*',
    redirect: '/404',
    hidden: true,
  },
  //编目新建路由
  {
    path: '/info',
    component: Layout,
    redirect: '/info/resourceCoding',
    alwaysShow: true,
    meta: {
      title: '信息管理系统',
      icon: 'apps-line',
    },
    children: [
      {
        path: '/resourceCoding',
        name: 'resourceCoding',
        meta: {
          title: '资源编码管理',
          icon: 'table-2',
        },
        children: [
          {
            path: 'resourceSort',
            name: 'resourceSort',
            component: () =>
              import('@/views/info/resourceCoding/resourceSort/index.vue'),
            meta: {
              title: '资源分类',
              icon: 'table-2',
            },
          },
          {
            path: 'codingRule',
            name: 'codingRule',
            component: () =>
              import('@/views/info/resourceCoding/codingRule/index.vue'),
            meta: {
              title: '编码规则管理',
              icon: 'remixicon-line',
            },
          },
          {
            path: 'codingInterface',
            name: 'codingInterface',
            component: () =>
              import('@/views/info/resourceCoding/codingInterface/index.vue'),
            meta: {
              title: '编码接口管理',
              icon: 'remixicon-line',
            },
          },
          {
            path: 'experimentResource',
            name: 'experimentResource',
            component: () =>
              import(
                '@/views/info/resourceCoding/experimentResource/index.vue'
              ),
            meta: {
              title: '试验资源实力编码',
              icon: 'remixicon-line',
            },
          },
          {
            path: 'maintenanceUnit',
            name: 'maintenanceUnit',
            component: () =>
              import('@/views/info/resourceCoding/maintenanceUnit/index.vue'),
            meta: {
              title: '维修单元编码及赋码',
              icon: 'remixicon-line',
            },
          },
          {
            path: "rqqtest",
            name: 'rqqtest',
            component: () => import('@/views/info/resourceCoding/rqqtest/index.vue'),
            meta: {
              title: '二维码测试页面',
              icon: 'remixicon-line'
            }
          },
          {
            path: 'wordPreview',
            name: 'word预览测试页面',
            component: () => import('@/views/info/resourceCoding/rqqtest/wordPreview.vue'),
            meta: {
              title: 'word预览测试页面',
              icon: 'remixicon-line'
            }
          }
        ],
      },
      {
        path: '/baseInfo',
        name: 'baseInfo',
        meta: {
          title: '基础数据管理',
          icon: 'remixicon-line',
        },
        children: [
          {
            path: 'systemInfo',
            name: 'systemInfo',
            component: () =>
              import('@/views/info/baseInfo/systemInfo/index.vue'),
            meta: {
              title: '系统信息管理',
              icon: 'error-warning-line',
            },
          },
          {
            path: 'manufacturer',
            name: 'manufacturer',
            component: () =>
              import('@/views/info/baseInfo/manufacturer/index.vue'),
            meta: {
              title: '生产厂家管理',
              icon: 'error-warning-line',
            },
          },
          {
            path: 'personnelInfo',
            name: 'personnelInfo',
            component: () =>
              import('@/views/info/baseInfo/personnelInfo/index.vue'),
            meta: {
              title: '人员信息管理',
              icon: 'error-warning-line',
            },
          },
          {
            path: 'dataDictionary',
            name: 'dataDictionary',
            component: () =>
              import('@/views/info/baseInfo/dataDictionary/index.vue'),
            meta: {
              title: '数据字典管理',
              icon: 'error-warning-line',
            },
          },
          {
            path: '/documentManagement',
            name: 'documentManagement',
            meta: {
              title: '技术文档管理',
              icon: 'error-warning-line',
            },
            children: [
              {
                path: 'documentMaintenancet',
                name: 'documentMaintenancet',
                component: () =>
                  import(
                    '@/views/info/baseInfo/documentManagement/documentMaintenancet/index.vue'
                  ),
                meta: {
                  title: '技术文档维护',
                  icon: 'error-warning-line',
                },
              },
              {
                path: 'documentReview',
                name: 'documentReview',
                component: () =>
                  import(
                    '@/views/info/baseInfo/documentManagement/documentReview/index.vue'
                  ),
                meta: {
                  title: '技术文档查阅',
                  icon: 'error-warning-line',
                },
              },
            ],
          },
          {
            path: 'dataSpecification',
            name: 'dataSpecification',
            component: () =>
              import('@/views/info/baseInfo/dataSpecification/index.vue'),
            meta: {
              title: '数据规范管理',
              icon: 'error-warning-line',
            },
          },
          {
            path: 'dataOrganization',
            name: 'dataOrganization',
            component: () =>
              import('@/views/info/baseInfo/dataOrganization/index.vue'),
            meta: {
              title: '数据组织管理',
              icon: 'error-warning-line',
            },
          },
        ],
      },
      {
        path: '/commonSupport',
        name: 'commonSupport',
        meta: {
          title: '共性支撑服务',
          icon: 'remixicon-line',
        },
        children: [
          {
            path: '/formManagement',
            name: 'formManagement',
            meta: {
              title: '采集表单管理',
              icon: 'table-2',
            },
            children: [
              {
                path: 'formConfiguration',
                name: 'formConfiguration',
                component: () =>
                  import(
                    '@/views/info/commonSupport/formManagement/formConfiguration/index.vue'
                  ),
                meta: {
                  title: '采集表单配置',
                  icon: 'table-2',
                },
              },
              {
                path: 'formApproval',
                name: 'formApproval',
                component: () =>
                  import(
                    '@/views/info/commonSupport/formManagement/formApproval/index.vue'
                  ),
                meta: {
                  title: '采集表单审批',
                  icon: 'table-2',
                },
              },
              {
                path: '/formList',
                name: 'formList',
                meta: {
                  title: '采集表单列表',
                  icon: 'table-2',
                },
                children: [
                  {
                    path: 'infoCollection',
                    name: 'infoCollection',
                    component: () =>
                      import(
                        '@/views/info/commonSupport/formManagement/formList/infoCollection/index.vue'
                      ),
                    meta: {
                      title: '计量信息采集',
                      icon: 'table-2',
                    },
                  },
                ],
              },
            ],
          },
          {
            path: 'logManagement',
            name: 'logManagement',
            meta: {
              title: '系统日志管理',
              icon: 'table-2',
            },
            children: [
              {
                path: 'loginLog',
                name: 'loginLog',
                component: () =>
                  import(
                    '@/views/info/commonSupport/logManagement/loginLog/index.vue'
                  ),
                meta: {
                  title: '登录日志',
                  icon: 'table-2',
                },
              },
              {
                path: 'opeLog',
                name: 'opeLog',
                component: () =>
                  import(
                    '@/views/info/commonSupport/logManagement/opeLog/index.vue'
                  ),
                meta: {
                  title: '操作日志',
                  icon: 'table-2',
                },
              },
            ],
          },
        ],
      },
    ],
  },
  {
    path: '/business',
    component: Layout,
    redirect: '/business/metrologicalCheck',
    alwaysShow: true,
    meta: {
      title: '业务应用系统',
      icon: 'apps-line',
    },
    children: [
      {
        path: '/metrologicalCheck',
        name: 'metrologicalCheck',
        meta: {
          title: '计量检校',
          icon: 'error-warning-line',
        },
        children: [
          {
            path: 'measurementStandard',
            name: 'measurementStandard',
            component: () =>
              import(
                '@/views/business/metrologicalCheck/measurementStandard/index.vue'
              ),
            meta: {
              title: '计量标准',
              icon: 'error-warning-line',
            },
          },
          {
            path: '/dailyCheck',
            name: 'dailyCheck',
            meta: {
              title: '日常检校',
              icon: 'error-warning-line',
            },
            children: [
              {
                path: 'yearCheck',
                name: 'yearCheck',
                component: () =>
                  import(
                    '@/views/business/metrologicalCheck/dailyCheck/yearCheck/index.vue'
                  ),
                meta: {
                  title: '年度计量检校管理',
                  icon: 'error-warning-line',
                },
              },
              {
                path: 'yearTrace',
                name: 'yearTrace',
                component: () =>
                  import(
                    '@/views/business/metrologicalCheck/dailyCheck/yearTrace/index.vue'
                  ),
                meta: {
                  title: '年度标准溯源管理',
                  icon: 'error-warning-line',
                },
              },
              {
                path: 'dayCheck',
                name: 'dayCheck',
                component: () =>
                  import(
                    '@/views/business/metrologicalCheck/dailyCheck/dayCheck/index.vue'
                  ),
                meta: {
                  title: '日常检校',
                  icon: 'error-warning-line',
                },
              },
            ],
          },
          {
            path: 'qualityConstruction',
            name: 'qualityConstruction',
            component: () =>
              import(
                '@/views/business/metrologicalCheck/qualityConstruction/index.vue'
              ),
            meta: {
              title: '质量体系建设',
              icon: 'error-warning-line',
            },
          },
          {
            path: 'modeManagement',
            name: 'modeManagement',
            component: () =>
              import(
                '@/views/business/metrologicalCheck/modeManagement/index.vue'
              ),
            meta: {
              title: '模型管理',
              icon: 'error-warning-line',
            },
          },
          {
            path: 'stateDetection',
            name: 'stateDetection',
            component: () =>
              import(
                '@/views/business/metrologicalCheck/stateDetection/index.vue'
              ),
            meta: {
              title: '状态检测',
              icon: 'error-warning-line',
            },
          },
          {
            path: 'comprehensiveQuery',
            name: 'comprehensiveQuery',
            component: () =>
              import(
                '@/views/business/metrologicalCheck/comprehensiveQuery/index.vue'
              ),
            meta: {
              title: '综合查询',
              icon: 'error-warning-line',
            },
          },
          {
            path: 'dataStatistics',
            name: 'dataStatistics',
            component: () =>
              import(
                '@/views/business/metrologicalCheck/dataStatistics/index.vue'
              ),
            meta: {
              title: '数据统计',
              icon: 'error-warning-line',
            },
          },
        ],
      },
    ],
  },
]
const router = createRouter({
  history: createWebHashHistory(),
  routes: constantRoutes,
})

export default router
